import request from '@/utils/request'

export const reqSpuList = (page,limit,category3Id)=>request({
  url:`/admin/product/${page}/${limit}`,
  method:'get',
  params:{category3Id}
})
export const getSpuById = (spuId)=>request({
  url:`/admin/product/getSpuById/${spuId}`,
  method:'get'
})
export const getTradeMarkList = ()=>request({
  url:"/admin/product/baseTrademark/getTrademarkList",
  method:'get'
})
export const getSpuImage = (spuId)=>request({
  url:`/admin/product/spuImageList/${spuId}`,
  method:'get'
})
export const getSaleAttrList = ()=>request({
  url:'/admin/product/baseSaleAttrList',
  method:'get'
})
//修改或添加spu 携带给服务器的值大致一样的,唯一区别是否携带id
export const reqAddOrUpdateSpu = spuInfo=>{
  //携带的参数 修改spu
  if(spuInfo.id){
    return request({url:'/admin/product/updateSpuInfo',method:'post',data:spuInfo})
  }else{
    //添加spu
    return request({url:'/admin/product/saveSpuInfo',method:'post',data:spuInfo})
  }
}
//删除spu
export const reqDeleteSpu = spuId =>request({url:`/admin/product/deleteSpu/${spuId}`,method:'delete'})